using System;
using System.Collections.Generic;
using UD.Seguridad.DataAccess;
using UD.Seguridad.Entity;
using UD.Utilities.Exceptions;

namespace UD.Seguridad.Business
{
    public class ProgramaBLL
    {
        private ProgramaDAL vProgramaDAL;
        public ProgramaBLL()
        {
            vProgramaDAL = new ProgramaDAL();
        }
        public int InsertarPrograma(Programa pPrograma)
        {
            try
            {
                return vProgramaDAL.InsertarPrograma(pPrograma);
            }
            catch (UserInterfaceException)
            {
                throw;
            }
            catch (Exception ex)
            {
                 throw new GenericException(ex);
            }
        }
        public int ModificarPrograma(Programa pPrograma)
        {
            try
            {
                return vProgramaDAL.ModificarPrograma(pPrograma);
            }
            catch (UserInterfaceException)
            {
                throw;
            }
            catch (Exception ex)
            {
                 throw new GenericException(ex);
            }
        }
        public int EliminarPrograma(Programa pPrograma)
        {
            try
            {
                return vProgramaDAL.EliminarPrograma(pPrograma);
            }
            catch (UserInterfaceException)
            {
                throw;
            }
            catch (Exception ex)
            {
                 throw new GenericException(ex);
            }
        }

        public Programa ConsultarPrograma(int pIdPrograma)
        {
            try
            {
                return vProgramaDAL.ConsultarPrograma(pIdPrograma);
            }
            catch (UserInterfaceException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new GenericException(ex);
            }
        }

        public List<Programa> ConsultarProgramas(int? pIdModulo, String pNombrePrograma, String pCodigoPrograma, int? pPosicionPrograma, Boolean? pEstadoPrograma, int? pPadrePrograma)
        {
            try
            {
                return vProgramaDAL.ConsultarProgramas(pIdModulo, pNombrePrograma, pCodigoPrograma, pPosicionPrograma, pEstadoPrograma, pPadrePrograma);
            }
            catch (UserInterfaceException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new GenericException(ex);
            }
        }
    }
}
